package test1230am;

public class Test18 {
    public static void main(String[] args) {
        // (18)找出数中最大元素的下标
        int[] arr = {5, 3, 7, 2, 6};
        maxxia(arr);
    }
    public static void maxxia(int[] arr) {
        int max = 0;
        int xia = 0;
        for(int i = 0; i < arr.length; i++){
            if(arr[i] > max){
                max = arr[i];
                xia = i;
            }
        }
        System.out.println("最大元素的下标为：" + xia);
    }
}
